<?php View::display('technic/menu');?>
<!-- .head -->
<header class="head">
	<!-- ."main-bar -->
	<div class="main-bar">
		<div class="container-fluid">
			<div class="row-fluid">
				<div class="span12">
					<h3>
						<i class="icon-wrench"></i> คำถามจาก USER
					</h3>
				</div>
			</div>
			<!-- /.row-fluid -->
		</div>
		<!-- /.container-fluid -->
	</div>
	<!-- /.main-bar -->
</header>
<!-- /.head -->
<!-- #content -->
<div id="content">
	<!-- .outer -->
	<div class="container-fluid outer">
	
		<div class="row-fluid">
			<!-- .inner -->
			<div class="span12 inner">
				<!--Begin Datatables-->
				<div class="row-fluid">
					<div class="span12">
						<div class="box">
							<header>
								<h5>คำถามจาก user</h5>
							</header>
							<div class="body">
								<table class="table table-bordered dataTable responsive">
									<thead>
										<tr>
											<th>สร้างเมื่อ</th>
											<th>ตอบล่าสุด</th>
											<th>หัวข้อ</th>
											<th>สถานะ</th>
											<th>account</th>
										</tr>
									</thead>
									<tbody>
										<?php foreach ($params['topics'] as $key => $value){
										$status = $value['status']==1? 'เปิด': 'ปิด';
										?>
										<tr>
											<td><?php $time = new DateTime($value['createTime']); echo $time->format('j/m/Y');?></td>
											<td>
											<?php
											if(is_null($value['modifyTime'])){ echo '-'; }
											else { $time = new DateTime($value['modifyTime']); echo $time->format('j/m/Y'); }
											?>
											</td>
											<td><a target="_blank" href="index.php?page=technic/topic&id=<?php echo $value['id'];?>"><?php echo $value['name'];?></a></td>
											<td><?php echo $status;?></td>
											<td><a target="_blank" href="index.php?page=accounting/account/detail&id=<?php echo $value['account']['id'];?>"><?php echo $value['account']['email'];?></a></td>
										</tr>
										<?php }?>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--Begin Datatables-->
	</div>
</div>
<script type="text/javascript">
$(function(){
	var oTable = $('.dataTable').dataTable({"bFilter": false, "bInfo": false, "bSort": false,
		sDom: "<'pull-right'l>t<'row-fluid'<'span6'f><'span6'p>>",
        sPaginationType: "bootstrap",
        oLanguage: {
            "sLengthMenu": "Show _MENU_ entries"
        }
    });

	function delRow(row){
		$(row).fadeOut(function(){
			row = $(row).get(0);
			oTable.fnDeleteRow(oTable.fnGetPosition(row));
		});
	}
});
</script>